package com.vae.auth.feignclient;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author: 35238
 * 功能: 如果CheckCodeClient接口出现异常，那么请求就会降级到这个类
 * 时间: 2024-07-05 23:32
 */
@Component
public class CheckCodeClientFactory implements FallbackFactory<CheckCodeClient> {
    @Override
    public CheckCodeClient create(Throwable throwable) {
        return new CheckCodeClient() {
            @Override
            public Boolean verify(String key, String code) {
                System.err.println("调用验证码服务熔断异常: "+ throwable.getMessage());
                return null;
            }
        };
    }
}
